/**
 * Copyright (C), 2018 store
 * Encoding: UTF-8
 * Date: 19-12-24 上午11:13
 * History:
 */
package com.swak.frame.common;

import org.apache.commons.lang3.StringUtils;

import com.swak.frame.common.support.PropertiesFactory;

/**
 * ImageDomainUtil.java
 *
 * @author ColleyMa
 * @version 19-12-24 上午11:13
 */
public class ImageDomainUtil {

    private final static String IMAGE_DOMAIN = "swak.frame.imagedomain";

    public static String getImgPath(String imgSource) {
        if (StringUtils.isEmpty(imgSource)) {
            return imgSource;
        }

        if (imgSource.indexOf("360buyimg.com") > -1) {
            return imgSource;
        }

        String imageDomain = PropertiesFactory.getString(IMAGE_DOMAIN);
        String imagePath = ImagePathUtil.formatImgDomain(imageDomain + imgSource);

        return imagePath;
    }
}
